home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
- <stack>
- <name>in.03</name>
- <id>-1</id>
- <cardCount>2</cardCount>
- <cardID>17566</cardID>
- <listID>2288</listID>
- <cantModify><false /></cantModify>
- <cantDelete><false /></cantDelete>
- <cantAbort><false /></cantAbort>
- <cardSize>
- <width>512</width>
- <height>208</height>
- </cardSize>
- <script>-- modified stack script for stack browsing, based originally on
- -- Free Text v.1 ... not thoroughly checked or tested yet!!!
-
- on openStack
- initGlobals -- set up many things for this stack
- pass openStack
- end openStack
-
- on closeStack
- -- close out files, vars, empty fields nicely
- set cursor to watch
- lock screen
- repeat for the number of cards -- close all database files
- if the short name of this bkgnd is "BrowserBg" then closeDatabase
- go to next card
- end repeat
- show menuBar
- pass closeStack
- end closeStack
-
- on closeDatabase
- -- called before opening a file as well as when leaving the stack
- get openCloseFiles (getTextFileRefNum(), getKeyFileRefNum(),¬
- getPtrFileRefNum())
- if not (getSubsetHandle(1) = 0 or getSubsetHandle(1) = empty) then
- get zbrowser ("RELEASESUBSET", getSubsetHandle(1))
- setSubsetHandle 1,0
- end if
- if not (getSubsetHandle(2) = 0 or getSubsetHandle(2) = empty) then
- get zbrowser ("RELEASESUBSET", getSubsetHandle(2))
- setSubsetHandle 2,0
- end if
- put empty into field "FTVars"
- put empty into field "Index1"
- put empty into field "Index2"
- put empty into field "Context"
- put empty into field "Database Name"
- hide field "searchPattern1"
- hide field "searchPattern2"
- hide bg button "and subsets"
- hide bg button "or subsets"
- hide bg button "not subset 1"
- hide bg button "not subset 2"
- hide bg button "fill subset 1"
- hide bg button "fill subset 2"
- end closeDatabase
-
- on initGlobals
- -- initialize many things here for the stack to use globally
- global indexLines, contextLines, maxIndexSampleCount,¬
- indexCountWidth, indexKeyWidth, contextLineLength, contextWordOffset,¬
- maxContextLinesSkipped, textChunkSize, textOffset, errorCount,¬
- contextGutterWidth, whichSubset
- put 7 into indexLines -- hold this many lines in Index fields
- put 7 into contextLines -- hold this many lines in Context field
- put 100 into maxIndexSampleCount -- sample size during subset counts
- put 5 into indexCountWidth -- this many digits of count info for Index
- put 28 into indexKeyWidth -- this many letters of Index words
- put 80 into contextLineLength -- this many letters of Context
- put 35 into contextWordOffset -- key word starts in this column
- put 100 into maxContextLinesSkipped
- -- make a line of dots after this many lines in subset are skipped
- put 25000 into textChunkSize -- grab this much for text field
- put 1 into textOffset -- put key word this far into text chunk
- put 0 into errorCount -- initialize counter to control error display
- put 0 into contextGutterWidth -- spaces before key word
- put 1 into whichSubset -- identify which subset, 1 or 2, is being used
- end initGlobals
-
- on checkOpenDatabase
- -- test to catch attempt to operate without an open indexed file;
- -- try turning it into an "Open Database" request if so!
- if (getTextFileRefNum() = 0 or getTextFileRefNum() = empty) then
- beep
- answer "No database open!"
- exit to HyperCard
- end if
- end checkOpenDatabase
-
- function clickedLineNum
- -- compute which line number of the field got the click
- return 1 + trunc((item 2 of the clickLoc - (item 2 of (the rectangle¬
- of the target))) / (the textheight of the target))
- end clickedLineNum
-
- function clickedOnLeftHalf
- -- see if click was on left half of the button, for AND and OR subsets
- put item 1 of the clickLoc into clickX
- put ((item 1 of the rect of the target) + (item 3 of the rect of the¬
- target)) / 2 into midPointX
- return (clickX < midPointX)
- end clickedOnLeftHalf
-
- on browseIndex1
- -- fill Index field #1
- global indexLines, maxIndexSampleCount, indexCountWidth, indexKeyWidth
- get zbrowser ("INDEX", getwordnum1(), indexLines,¬
- maxIndexSampleCount, indexCountWidth, indexKeyWidth,¬
- getKeyFileRefNum(), getPtrFileRefNum(), getSubsetHandle(1))
- put line 1 to indexLines of It into field "Index1"
- setInstanceList1 (line (indexLines+1) to (2*indexLines) of It)
- end browseIndex1
-
- on browseIndex2
- -- fill Index field #2
- global indexLines, maxIndexSampleCount, indexCountWidth, indexKeyWidth
- get zbrowser ("INDEX", getwordnum2(), indexLines,¬
- maxIndexSampleCount, indexCountWidth, indexKeyWidth,¬
- getKeyFileRefNum(), getPtrFileRefNum(), getSubsetHandle(2))
- put line 1 to indexLines of It into field "Index2"
- setInstanceList2 (line (indexLines+1) to (2*indexLines) of It)
- end browseIndex2
-
- on browseContext lineOffset
- -- fill the Context field
- global contextLines, contextLineLength, contextWordOffset,¬
- maxContextLinesSkipped, contextGutterWidth, whichSubset
- get zbrowser ("CONTEXT", getInstanceNum(), contextLines,¬
- lineOffset, contextLineLength, contextWordOffset,¬
- maxContextLinesSkipped, contextGutterWidth, getPtrFileRefNum(),¬
- getTextFileRefNum(), getSubsetHandle(whichSubset))
- put line 1 to contextLines of It into field Context
- setTextPtrList (line (contextLines+1) to (2*contextLines) of It)
- end browseContext
-
- --
- -- the remaining functions set and fetch values of various useful
- -- quantities; do it this way to hide the details of how things are
- -- stored....
- --
-
- function getTextFileRefNum
- return line 1 of field FTVars
- end getTextFileRefNum
-
- on setTextFileRefNum refNum
- put refNum into line 1 of field FTVars
- end setTextFileRefNum
-
- function getKeyFileRefNum
- return line 2 of field FTVars
- end getKeyFileRefNum
-
- on setKeyFileRefNum refNum
- put refNum into line 2 of field FTVars
- end setKeyFileRefNum
-
- function getPtrFileRefNum
- return line 3 of field FTVars
- end getPtrFileRefNum
-
- on setPtrFileRefNum refNum
- put refNum into line 3 of field FTVars
- end setPtrFileRefNum
-
- function getWordNum1
- return line 4 of field FTVars
- end getWordNum1
-
- on setWordNum1 wordNum
- put wordNum into line 4 of field FTVars
- end setWordNum1
-
- function getWordNum2
- return line 5 of field FTVars
- end getWordNum2
-
- on setWordNum2 wordNum
- put wordNum into line 5 of field FTVars
- end setWordNum2
-
- function getInstanceNum
- return line 6 of field FTVars
- end getInstanceNum
-
- on setInstanceNum instanceNum
- put instanceNum into line 6 of field FTVars
- end setInstanceNum
-
- function getTextStart
- return line 7 of field FTVars
- end getTextStart
-
- on setTextStart textStart
- put textStart into line 7 of field FTVars
- end setTextStart
-
- function getTextTarget
- return line 8 of field FTVars
- end getTextTarget
-
- on setTextTarget textTarget
- put textTarget into line 8 of field FTVars
- end setTextTarget
-
- function getTextEnd
- return line 9 of field FTVars
- end getTextEnd
-
- on setTextEnd textEnd
- put textEnd into line 9 of field FTVars
- end setTextEnd
-
- function getSubsetHandle subsetNumber
- return line 9+subsetNumber of field FTVars
- end getSubsetHandle
-
- on setSubsetHandle subsetNumber, handle
- put handle into line 9+subsetNumber of field FTVars
- end setSubsetHandle
-
- function getNeighborhoodSize
- return line 12 of field FTVars
- end getNeighborhoodSize
-
- on setNeighborhoodSize size
- put size into line 12 of field FTVars
- end setNeighborhoodSize
-
- -- lines 13 through 19 of field FTVars are currently unused
-
- function getInstanceList1item instanceNum
- return line 19+instanceNum of field FTVars
- end getInstanceList1item
-
- on setInstanceList1 instanceList
- global indexLines
- put instanceList into line 20 to 19+indexLines of field FTVars
- end setInstanceList1
-
- function getInstanceList2item instanceNum
- global indexLines
- return line 19+indexLines+instanceNum of field FTVars
- end getInstanceList2item
-
- on setInstanceList2 instanceList
- global indexLines
- put instanceList into line 20+indexLInes to 19+2*indexLines¬
- of field FTVars
- end setInstanceList2
-
- function getTextPtrListInstanceItem itemNum
- global indexLines, contextLines
- return word 1 of line 19+2*indexLines+itemNum of field FTVars
- end getTextPtrListInstanceItem
-
- function getTextPtrListPtrItem itemNum
- global indexLines, contextLines
- return word 2 of line 19+2*indexLines+itemNum of field FTVars
- end getTextPtrListPtrItem
-
- on setTextPtrList textPtrList
- global indexLines, contextLines
- put textPtrList into line 20+2*indexLInes to 19+2*indexLines¬
- +contextLines of field FTVars
- end setTextPtrList
-
-
- </script>
- <background id="2734" file="background_2734.xml" name="BrowserBg" />
- <background id="3166" file="background_3166.xml" name="Documentation Bg" />
- <card id="17566" file="card_17566.xml" marked="false" name="" owner="3166" />
- <card id="2966" file="card_2966.xml" marked="false" name="FirstBrowserCard" owner="2734" />
- </stack>
-